<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE composition
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
                template="layout.xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:define name="content">
        <h:form id="createUserMask">
            <h:outputLabel value="#{msg.createUserInfo}" rendered="#{!userController.eingeloggt}" style="color:green;"/>
            <table>
                <tr>
                    <td><h:outputLabel value="#{msg.username}"/></td>
                    <td><h:inputText value="#{userController.nutzerNamen}"/></td>
                </tr>
                <tr>
                    <td><h:outputLabel value="#{msg.oldPassword}" rendered="#{userController.eingeloggt}" /></td>
                    <td>
                        <h:inputSecret id="createUserOldPasswort" value="#{userController.oldPasswort}" required="true"
                                       requiredMessage="#{msg.oldPasswortRequiredMessage}" rendered="#{userController.eingeloggt}"/>
                    </td>
                    <td><h:message for="createUserOldPasswort" style="color:red;" rendered="#{userController.eingeloggt}"/></td>
                </tr>
                <tr>
                    <td><h:outputLabel value="#{msg.password}" rendered="#{userController.eingeloggt}" /></td>
                    <td>
                        <h:inputSecret id="createUserPasswort" value="#{userController.newPasswort}" required="true"
                                       requiredMessage="#{msg.forgotPasswortRequiredMessage}" rendered="#{userController.eingeloggt}"/>
                    </td>
                    <td><h:message for="createUserPasswort" style="color:red;" rendered="#{userController.eingeloggt}"/></td>
                </tr>
                <tr>
                    <td><h:outputLabel value="#{msg.repeatPassword} " rendered="#{userController.eingeloggt}"/></td>
                    <td>
                        <h:inputSecret id="createUserRepeatPasswort" required="true"
                                       requiredMessage="#{msg.forgotPasswortRequiredMessage}" rendered="#{userController.eingeloggt}" value="#{userController.passwortRepeat}"/>
                    </td>
                    <td><h:message for="createUserRepeatPasswort" style="color:red;" rendered="#{userController.eingeloggt}"/></td>
                </tr>
                <tr>
                    <td><h:outputLabel value="#{msg.email} "/></td>
                    <td>
                        <h:inputText id="createUserMail" value="#{userController.email}" required="true"
                                     requiredMessage="#{msg.forgotEmail}">
                            <f:validator validatorId="EmailValidator"/>
                        </h:inputText>
                    </td>
                    <td><h:message for="createUserMail" style="color:red;"/></td>
                </tr>
                <tr>
                    <td>
                        <h:commandButton value="#{msg.save}" action="#{userController.erzeugeBenutzer}"
                                         rendered="#{!userController.eingeloggt}"/>
                        <h:commandButton value="#{msg.save}" action="#{userController.updateBenutzer}"
                                         rendered="#{userController.eingeloggt}"/>
                    </td>

                </tr>
            </table>
        </h:form>
        <h:form>
            <table>
                <tr>
                    <td>
                        <h:commandButton value="#{msg.abort}" action="index"/>
                    </td>
                </tr>
            </table>
        </h:form>
        <h:messages for="createUserMask" style="color:red"/>
    </ui:define>
</ui:composition>